<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取当前地理位置01</title>
    <style>
        span {
            color: red;
        }
    </style>
</head>

<body>
    <h1>您当前的位置是: <span id="address"></span></h1>
    <h1>是否GPS定位: <span id="gps"></span></h1>
    <script src="./jquery.min.js"></script>
    <script>
        $.ajax({
            url: 'https://api.asilu.com/geo/',
            dataType: 'jsonp',
            success: res => {
                const {
                    address,
                    gps
                } = res
                $('#address').html(address)
                if (gps) {
                    $('#gps').html('是')
                } else {
                    $('#gps').html('否')
                }
                // console.log(res);
            }
        })
    </script>
</body>

</html>